#ifndef _FOSSIL_LOG_H
#define _FOSSIL_LOG_H

#include <fstream>
#include "Singleton.h"

#if defined(LOG_ENABLE)
# define LOG_TRIVIAL(msg) Log::Instance()->LogMessage(LogLevelTrivial, msg)
# define LOG_WARNING(msg) Log::Instance()->LogMessage(LogLevelWarning, msg)
# define LOG_ERROR(msg) Log::Instance()->LogMessage(LogLevelError, msg)
#else
# define LOG_TRIVIAL(msg)
# define LOG_WARNING(msg)
# define LOG_ERROR(msg)
#endif//defined(LOG_ENABLE)

namespace Fossil
{
	enum LogLevel
	{
		LogLevelTrivial	= 0,
		LogLevelWarning	= 1,
		LogLevelError	= 2,
	};

	class Log : public Singleton<Log>
	{
	public:
		Log(void) {}
		~Log(void) {}

		void Initialise(LogLevel Level = LogLevelWarning);
		void Destroy();

		void LogMessage(LogLevel Level, const char* pMessage);

	private:
		LogLevel		m_LogLevel;
		std::ofstream	m_FileStream;

		const char* GetLogLevelClass(LogLevel Level);
	};
};

#endif//_FOSSIL_LOG_H
